#include "pch.h"
#include "Vector.h"

const float dxroids::Vector::MinTolerance = 0.0001f;

void dxroids::Vector::Normalize()
{   
   float magnitude = Magnitude();

   if (magnitude < Vector::MinTolerance)
   {
      magnitude = 1.0f;
   }

   x_ /= magnitude;
   y_ /= magnitude;

   if (fabs(x_) < Vector::MinTolerance)
   {
      x_ = 0.0f;
   }

   if (fabs(y_) < Vector::MinTolerance)
   {
      y_ = 0.0f;
   }
}